//
//  MVCollectionViewCell.m
//  23-QQ音乐
//
//  Created by 曹曹 on 16/8/15.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "MVCollectionViewCell.h"
#import "MVConllectionList.h"
#import "UIImageView+WebCache.h"
#import "MVSingers.h"

@interface MVCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *picView;
@property (weak, nonatomic) IBOutlet UILabel *listenLabel;
@property (weak, nonatomic) IBOutlet UILabel *singerLabel;
@property (weak, nonatomic) IBOutlet UILabel *mvdescLabel;

@end

@implementation MVCollectionViewCell

- (void)setList:(MVConllectionList *)list {
    _list = list;
    _listenLabel.text = [NSString stringWithFormat:@"%ld", list.listennum];
    if (list.listennum == 0) {
        _listenLabel.text = @"最新上架";
    }
    if (list.listennum > 9999) {
        NSInteger single = list.listennum / 10000;
        NSInteger decimal = list.listennum % 10000 / 1000;
        NSString *text = [NSString stringWithFormat:@"%ld.%ld万", single, decimal];
        _listenLabel.text = text;
    }
    _singerLabel.text = [[list.mvtitle stringByAppendingString:@" - "] stringByAppendingString:list.singername];
    _mvdescLabel.text = list.mvdesc;
    if (list.picurl != nil) {
        [_picView sd_setImageWithURL:[NSURL URLWithString:list.picurl]];
    } else {
        NSString *imageURL = [NSString stringWithFormat:@"http://shp.qpic.cn/qqvideo_ori/0/%@_360_204/0?max_age=259200", list.vid];
        [_picView sd_setImageWithURL:[NSURL URLWithString:imageURL]];
    }
}

@end
